<!DOCTYPE html>
<html class="x-admin-sm">
<#include "../layout/meta.ftl">
<body class="layui-layout-body">
<div style="margin: 2vw">

    <form class="layui-form">

        <div class="layui-form-item">
            <label class="layui-form-label">映射路径</label>
            <div class="layui-input-block">
                <input type="text" name="path" required placeholder="请输入镜像映射路径" autocomplete="off" value=""
                       class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">仓库host</label>
            <div class="layui-input-block">
                <input type="text" name="host" required placeholder="仓库host" autocomplete="off" value="${host}"
                       class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">仓库port</label>
            <div class="layui-input-block">
                <input type="text" name="port" required placeholder="仓库port" autocomplete="off" value=""
                       class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-normal" lay-submit lay-filter="formAddNode">创建</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>

<script>
    //Demo
    layui.use('form', function () {
        var form = layui.form;
        //监听提交
        form.on('submit(formAddNode)', function (data) {
            layer.msg("处理中请稍等...");
            $.ajax({
                url: "/registry/create",
                data: data.field,
                type: "post",
                success: function (res) {
                    layer.msg(res.msg);
                    setTimeout(function () {
                        xadmin.close();
                        // 可以对父窗口进行刷新
                        xadmin.father_reload();
                    }, 1000)
                }
            });

            return false;
        });
    });


</script>

</body>
</html>